package com.vhall.component.entity.room.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/6/5 12:19
 */
@Getter
@AllArgsConstructor
public enum LimitTypeEnum {

    PHONE(0, "手机号", ""),
    WATCH_ALL(2, "全部观看", ""),

    FUND_ACCOUNT(4, "资金账号", ""),

    ORDINARY_MEMBERS(5, "普通会员", "1"),
    SILVER_MEMBER(6, "白银会员", "2"),
    GOLD_MEMBER(7, "黄金会员", "3"),
    PLATINUM_MEMBER(8, "铂金会员", "4"),

    FUND_ACCOUNT1(9, "资金账号-C1", "C1"),
    FUND_ACCOUNT2(10, "资金账号-C2", "C2"),
    FUND_ACCOUNT3(11, "资金账号-C3", "C3"),
    FUND_ACCOUNT4(12, "资金账号-C4", "C4"),
    FUND_ACCOUNT5(13, "资金账号-C5", "C5"),


    ;
    private Integer value;

    private String description;

    /**
     * 与兴业交互，对应的值
     */
    private String correspondingValue;

    public static String getDescription(Integer value) {
        LimitTypeEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static LimitTypeEnum parse(Integer value) {
        for (LimitTypeEnum anEnum : LimitTypeEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }

    public static String getCorrespondingValue(Integer value) {
        LimitTypeEnum parse = parse(value);
        if (parse != null) {
            return parse.getCorrespondingValue();
        }
        return StringUtils.EMPTY;
    }
}
